package com.situ.day13.reflect;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;

public class Clinet {

	public static void main(String[] args) throws Exception {
		FileInputStream fileInputStream = new FileInputStream("src/com/situ/day13/reflect/db.properties");
		Properties properties = new Properties();
		
		properties.load(fileInputStream);
		String className = properties.getProperty("className");
		System.out.println(className);
		
		Class clazz = Class.forName(className);
		// 如果类里面有无参构造方法，可以直接clazz.newInstance()
	    // AbstractDB db = new MySql();
		AbstractDB db = (AbstractDB) clazz.newInstance();
		db.getConnection();
	}
}
